/**
 * Created by Administrator on 2014/4/7.
 */

/**
 * 设置 setTimeout hack
 * @param callback
 * @param delay
 */
var mySetTimeout = function (callback, delay, target) {
    if (arguments.length < 3) {
        trace("the arguments length less 3....");
        trace(callback);
        return;
    }
    if (!target.scheduleOnce) {
        var node = cc.Director.getInstance().getRunningScene();
        node.scheduleOnce(function () {
            callback.call(target);
        }, delay / 1000);
    } else {
        target.scheduleOnce(callback, delay / 1000);
    }
}
var setTimeout = setTimeout || mySetTimeout;

/**
 * 强转 int
 * @param str
 * @returns {number}
 */
function int(str) {
    return parseInt(str);
}

/**
 * 返回整数区间
 * @param min
 * @param max
 * @returns {number}
 */
function randomInt(min, max) {
    return int(Math.random() * (max - min) + min);
}
